<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	
	
	xmlns:composite="http://xmlns.jcp.org/jsf/composite">

<composite:interface name="tileContainer"
	displayName="Tile container respectively category."
	shortDescription="This tile container may be used to gather multiple different tiles. Caution. Let CSS take care of the layout, the composite the logic.">
	<composite:attribute name="pubCategoryId" type="java.lang.Long"
		required="true" />
</composite:interface>

<composite:implementation
	xmlns:mywidgets="http://xmlns.jcp.org/jsf/composite/widgets">
	#{pubCategoryController.init(cc.attrs.pubCategoryId)}
	<div class="tileContainer">
		<div class="title">#{pubCategoryController.name}</div>

		<ui:repeat value="#{pubCategoryController.listOfPublications}"
			var="pubItem">
			#{pubController.init(pubItem.id)}
					<h:outputLink value="publication.jsf">
				<f:param name="pubId" value="#{pubItem.id}" />
				<mywidgets:tileMidPictureTitleTeaser pubId="#{pubController.id}"
					isVerticalStacked="false"
					rendered="#{pubController.severityLevel >= 3}" />

				<mywidgets:tileSmallPictureTitle pubId="#{pubController.id}"
					isVerticalStacked="false"
					rendered="#{pubController.severityLevel == 2 and pubController.headerImageAvailable}" />

				<mywidgets:tileSmallTitle pubId="#{pubController.id}"
					rendered="#{pubController.severityLevel == 1 or (pubController.severityLevel == 2 and !pubController.headerImageAvailable)}" />
			</h:outputLink>

			<mywidgets:pubIcons pubId="#{pubController.id}" />

			<script>
				// append the script to the div
				$("#pubIcons_#{pubController.id}").appendTo("#details_#{pubController.id}");
				</script>
		</ui:repeat>
	</div>
</composite:implementation>
</html>